package com.xnyzc.lhy.mis.controller.cmsapi.dict;

import com.xnyzc.lhy.common.entity.Rv;
import com.xnyzc.lhy.mis.entity.param.cms.dict.DictParam;
import com.xnyzc.lhy.mis.service.cms.dict.DictService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 字典管理
 *
 * @Author: wangshuo
 * @Date: 2019-08-24 14:11
 */
@RestController
@RequestMapping("/cmsapi/dict")
public class DictController {

    @Autowired
    private DictService dictService;

    /**
     * 获取字典管理列表
     * @return
     */
    @ApiOperation(value = "获取字典管理列表", notes = "获取字典管理列表")
    @PostMapping(value = "/getDictList")
    public Rv getDictList(
            @ApiParam(name = "param", value = "接入传参") @RequestBody DictParam param
    ) {
        return Rv.wrap(dictService.getDictList(param));
    }

    /**
     * 字典管理详情
     * @return
     */
    @ApiOperation(value = "字典管理详情", notes = "字典管理详情")
    @PostMapping(value = "/getDictDetails")
    public Rv getDictDetails(
            @ApiParam(name = "param", value = "接入传参") @RequestBody DictParam param
    ) {
        return Rv.wrap(dictService.getDictDetails(param));
    }

    /**
     * 字典管理新增、修改
     * @return
     */
    @ApiOperation(value = "字典管理新增、修改", notes = "字典管理新增、修改")
    @PostMapping(value = "/getUpdateDict")
    public Rv getUpdateDict(
            @ApiParam(name = "param", value = "接入传参") @RequestBody DictParam param
    ) {
        return Rv.wrap(dictService.getUpdateDict(param));
    }

    /**
     * 删除字典配置
     * @return
     */
    @ApiOperation(value = "删除字典配置", notes = "删除字典配置")
    @PostMapping(value = "/getDeleteDict")
    public Rv getDeleteDict(
            @ApiParam(name = "param", value = "接入传参") @RequestBody DictParam param
    ) {
        return Rv.wrap(dictService.getDeleteDict(param));
    }

    /**
     * 查询已有的字典类型
     * @return
     */
    @ApiOperation(value = "查询已有的字典类型", notes = "查询已有的字典类型")
    @GetMapping(value = "/getDictTypeList")
    public Rv getDictTypeList(
    ) {
        return Rv.wrap(dictService.getDictTypeList());
    }

    /**
     * 字典类型新增
     * @return
     */
    @ApiOperation(value = "字典类型新增", notes = "字典类型新增")
    @PostMapping(value = "/addDictType")
    public Rv addDictType(
            @ApiParam(name = "param", value = "接入传参") @RequestBody DictParam param
    ) {
        return Rv.wrap(dictService.addDictType(param));
    }

}
